#ifndef FIELDCALLBACK_H
#define FIELDCALLBACK_H

#include "common.h"
#include "datafilereader.h"


typedef struct _AngleScale
{
    float angle = 0.0f;
    float scale = 1.0f;
}AngleScale;

typedef std::shared_ptr<AngleScale> PAngleScale;
typedef std::vector<PAngleScale> VecPAngleScale;

const float PI = 3.14f;

class fieldCallBack
{
public:
    fieldCallBack();
    void getAngleScale(Data& alldata);

protected:
    //模
    inline float normal(osg::Vec3 v)
    {
        return(sqrt(v.x()*v.x() + v.z()*v.z()));
    }
    //点积
    inline dotProduct(osg::Vec3 v1,osg::Vec3 v2)
    {
        return(v1.x()*v2.x() + v1.z()*v2.z());
    }
    //两向量夹角
    inline float angle(osg::Vec3 v1,osg::Vec3 v2)
    {
        return(acos( dotProduct(v1,v2) / (normal(v1) * normal(v2) ) ) );
    }


private:
    VecPAngleScale vPAngleScale;

};

#endif // FIELDCALLBACK_H
